<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"

      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./Test.xhtml">
        <ui:define name="content">
             <p:dataTable var="item" value="#{contactBean.viewContact}"
                             paginator="true" rows="10"
                             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             rowsPerPageTemplate="5,10,15"
                             selection="selectedAU"
                             selectionMode="single">
                    <f:facet name="header">
                        Show all Contact
                    </f:facet>

                 <p:column sortBy="#{item.firstName}" filterBy="#{item.firstName}">
                        <f:facet name="header">
                            <h:outputText value="Name" />
                        </f:facet>
                     <h:outputText value="#{item.firstName}">

                        </h:outputText>
                    </p:column>
                 <p:column sortBy="#{item.yourEmail}" filterBy="#{item.yourEmail}">
                        <f:facet name="header">
                            <h:outputText value="Email"/>
                        </f:facet>
                     <h:outputText value="#{item.yourEmail}">
                        </h:outputText>
                    </p:column>
                 <p:column sortBy="#{item.message}"  filterBy="#{item.message}">
                        <f:facet name="header">
                            <h:outputText value="Content"/>
                        </f:facet>
                     <h:outputText value="#{item.message}">
                        </h:outputText>
                    </p:column>
                 <p:column sortBy="#{item.ctDate}"  filterBy="#{item.ctDate}">
                        <f:facet name="header">
                            <h:outputText value="Date"/>
                        </f:facet>
                     <h:outputText value="#{item.ctDate}">
                        </h:outputText>
                    </p:column>
                 <p:column sortBy="#{item.status}"  filterBy="#{item.status}">
                        <f:facet name="header">
                            <h:outputText value="Status"/>
                        </f:facet>
                     <h:outputText value="#{item.status}">
                        </h:outputText>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            Reply
                        </f:facet>
                        <h:commandButton action="replyContact"  value="Reply" type="image" image="../resources/images/table/message_reply.png">
                            <f:setPropertyActionListener value="#{item}"
                                                         target="#{contactBean.selectedContact}" />
                        </h:commandButton>

                    </p:column>

                    <p:column>
                        <f:facet name="header">
                            Delete
                        </f:facet>

                        <h:commandButton action="Contact" actionListener="#{contactBean.deleteContact(item)}"  value="Delete" type="image" image="../resources/images/table/action_delete.gif"/>

                    </p:column>

                </p:dataTable>

            </ui:define>
        </ui:composition>

    </body>
</html>
